-
Notifications
You must be signed in to change notification settings - Fork 10
Post process #138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: festim2
Are you sure you want to change the base?
Post process #138
Conversation
| ] | ||
| ``` | ||
|
|
||
| These `.bp` exports can then be viewed in Paraview. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the following subsection, you discuss ParaView in more detail. It might be helpful in this subsection to include a link or brief pointer indicating that the next section will cover how to use ParaView.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The figure would be clearer with units added to the color bar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't agree, the point here is to show the "raw" visualisation inside paraview. As in what would the users see if they simply open this file in paraview.
In the Paraview section we can go in details and show how to customise the colourbar etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we display the figure with all selectable parameters shown in the drop-down menu?
| figure = u_plotter.screenshot("concentration.png") | ||
| ``` | ||
|
|
||
| ## Plotting the solution for continuous problems ## |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This subtitle seems the same as the previous one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ## Plotting the solution for continuous problems ## | |
| ## Plotting the solution for discontinuous problems ## |
RemDelaporteMathurin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ck768 a few comments on my side
|
|
||
| # Using PyVista for interactive visualization # | ||
|
|
||
| PyVista has many helpful capabilities for 3D visualization based on VTK code, and is used frequently throughout the FESTIM workshop. Users can use PyVista in Jupyter Notebook to visualize fields and meshes interactively. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should state that this is not suitable for transient data. Throughout the workshop we use it to display either steady state data, or the final timestep.
| pyvista.start_xvfb() | ||
| pyvista.set_jupyter_backend("html") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is only useful for the workshop on RTD, I would put it in a separate hidden cell
| def make_ugrid(solution): | ||
| topology, cell_types, geometry = plot.vtk_mesh(solution.function_space) | ||
| u_grid = pyvista.UnstructuredGrid(topology, cell_types, geometry) | ||
| u_grid.point_data["c"] = solution.x.array.real | ||
| u_grid.set_active_scalars("c") | ||
| return u_grid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having this function here may be confusing. This is a tutorial on pyvista so let's break things down step by step to make sure readers understand the building blocks
Especially since in this specific example you only use the function once
| u_plotter = pyvista.Plotter() | ||
| u_grid = make_ugrid(H.post_processing_solution) | ||
| u_plotter.add_mesh(u_grid, cmap="viridis", show_edges=False) | ||
| u_plotter.view_xy() | ||
| u_plotter.add_text("Hydrogen concentration", font_size=12) | ||
| if not pyvista.OFF_SCREEN: | ||
| u_plotter.show() | ||
| else: | ||
| figure = u_plotter.screenshot("concentration.png") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is the pyvista interactive viz tutorial, i think it is extremely important to break this down more granularly.
"First we instanciate a Plotter object, then we use the dolfinx function plot.vtk_mesh with the functionspace of itnerest, here the solution's functionspace to get the topology, the cell_types, the geometry, which are needed to make a pyvista UnstructuredGrid object. Then we attach point data to this grid, etc."
| figure = u_plotter.screenshot("concentration.png") | ||
| ``` | ||
|
|
||
| ## Plotting the solution for continuous problems ## |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ## Plotting the solution for continuous problems ## | |
| ## Plotting the solution for discontinuous problems ## |
| name: python3 | ||
| --- | ||
|
|
||
| # Viewing exports in Paraview # |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # Viewing exports in Paraview # | |
| # Visualising fields in Paraview # |
|
|
||
| +++ | ||
|
|
||
| ## Creating a VTX species export ## |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After this code cell we should say what the users should expect to see (ie. the creation of a folder called "paraview/out.bp")
|
|
||
| ## Creating a VTX species export ## | ||
|
|
||
| First, let us run a simple 2D diffusion problem and export a VTK file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| First, let us run a simple 2D diffusion problem and export a VTK file: | |
| First, let us run a simple 2D diffusion problem and export to VTX: |
| name: python3 | ||
| --- | ||
|
|
||
| # Viewing exports in Paraview # |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the step-by-step guide. We should extend this with:
- the special case of a 1D field where you need to Plot Over Line
- some basic paraview features:
- changing the colourbar
- slicing (using 3D data)
- plotting a profile
- transient data and time controls (play, back, forward...)
| Then, we select our `out.bp` file and press OK on the bottom: | ||
|
|
||
| ```{image} paraview/paraview_selecting_file.png | ||
| :class: bg-primary mb-1 | ||
| :align: center | ||
| ``` | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the first time you open a .bp file a pop up windows shows up and you need to select from 2 or 3 readers.
No description provided.